package com.lanhai.longheng.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.lanhai.longheng.dao.DeviceDao;
import com.lanhai.longheng.dao.DeviceGroupDao;

/**
 * 设备数据库操作
 * @author zhengwei
 *
 */
public interface DeviceMapper  extends SuperMapper{
	  DeviceDao getObjById(long deviceid) ;
	  
	  DeviceDao getObjByDotNo(int dotno) ;
	
	  DeviceDao getObj(@Param(value = "ip")  String ip,@Param(value = "line") int line) ;
	 
	 
	  String getCmdSign (@Param(value = "ip") String ip);
	  
	  //清理agv占用的其它的机台
	  void clearOtherDevice(@Param(value = "id") long id,@Param(value = "agvid") int agvid);
	  
	  //设备解锁
	  int unlockForAgv(int agvid);
	  int lockDevice(@Param(value = "id") long id,@Param(value = "agvid") int agvid);
      int unlockDeviceByDot(@Param(value = "dotno")int dotno,@Param(value = "agvid")int agvid ,@Param(value = "lasttime") long lasttime);
	  
 	  int unlockDeviceById(@Param(value = "id")long id ,@Param(value = "lasttime") long lasttime);
	  
	  //可用的机台
	  List<DeviceGroupDao> getEmptyList(@Param(value="process")String process,@Param(value="specialline") int specialline );
	  
	  //可用的机台（决策点用）
	  List<DeviceGroupDao> getEmptyListForDecide(@Param(value="process")String process );
	  
	  
	  
	  DeviceGroupDao findLockDeviceForAgv( @Param(value="agvid")int agvid,@Param(value="processgroup")String processgroup);

	  //获取二维码对应的机台
	  DeviceDao getObjByQr(int  dotno) ;
}
